/*
 * Copyright(c) 2023 NeatLogic Co., Ltd. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package neatlogic.module.pbc.publicapi;

import neatlogic.framework.common.constvalue.ApiParamType;
import neatlogic.framework.restful.annotation.Description;
import neatlogic.framework.restful.annotation.Input;
import neatlogic.framework.restful.annotation.OperationType;
import neatlogic.framework.restful.annotation.Param;
import neatlogic.framework.restful.constvalue.OperationTypeEnum;
import neatlogic.framework.restful.core.publicapi.PublicApiComponentBase;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;


@Service
@OperationType(type = OperationTypeEnum.OPERATE)
public class ValidateDataApi extends PublicApiComponentBase {


    @Override
    public String getToken() {
        return "/webproxy/fig2fics/pshare/api/prod/FICS/api/fics/dataElementInstance/requestCheck";
    }

    @Override
    public String getName() {
        return "金融机构端使用此接口发送数据元检核请求";
    }

    @Override
    public String getConfig() {
        return null;
    }

    @Override
    public boolean isRaw() {
        return true;
    }


    @Input({@Param(name = "grant_type", type = ApiParamType.STRING, desc = "grant_type"),
            @Param(name = "client_id", type = ApiParamType.STRING, desc = "client_id"),
            @Param(name = "client_secret", type = ApiParamType.STRING, desc = "client_secret")})
    @Description(desc = "金融机构端使用此接口发送数据元检核请求")
    @Override
    public Object myDoService(JSONObject paramObj) throws Exception {
        System.out.println("请求审核：" + paramObj.toJSONString());
        return JSONObject.parse("{\n" +
                "\"groupId\": \"51244123381A487798AF515092A008C3\",\n" +
                "\"code\": \"WL-30000\",\n" +
                "\"msg\": \"接收成功\"\n" +
                "}\n");
    }
}
